/**
 * util.types.is……() 进行类型检查
 */
let util = require('util');
//判断value是否为内置的isAnyArrayBuffer实例
console.log("=====arrayBuffer=======");
console.log(util.types.isAnyArrayBuffer(new ArrayBuffer()));
console.log(util.types.isAnyArrayBuffer(new SharedArrayBuffer()));

//判断value是否为内置的ArrayBufferView实例
console.log("=====arrayBufferView=======");
console.log(util.types.isArrayBufferView(new Int8Array()));
console.log(util.types.isArrayBufferView(Buffer.from("您好")));
console.log(util.types.isArrayBufferView(new ArrayBuffer()));

//判断value是否为内置的ArrayBuffer实例
console.log("=====arrayBufferView=======");
console.log(util.types.isArrayBuffer(new ArrayBuffer()));
console.log(util.types.isArrayBuffer(new SharedArrayBuffer()));
//判断value是否为异步函数
console.log("=====asyncFunction=======");
console.log(util.types.isAsyncFunction(function(){
    return 10;
}));
console.log(util.types.isAsyncFunction(async function(){
    return 10;
}));
//判断value是否为内置的Date实例
console.log("=====date=======");
console.log(util.types.isDate(new Date()));
//判断value是否为内置的Map实例
console.log("=====map=======");
console.log(util.types.isMap(new Map()));
//判断value是否为内置的Promise实例
console.log("=====promise======="); 
console.log(util.types.isPromise(new Promise(()=>{})));
//判断value是否为内置的RegExp实例
console.log("=====regexp=======");
console.log(util.types.isRegExp(new RegExp("^[0-9]+$")));
//判断value是否为内置的Set实例
console.log("=====set=======");
console.log(util.types.isSet(new Set()));
//判断value是否为内置的String实例
console.log("=====string=======");
console.log(util.types.isStringObject("hello"));
//判断value是否为内置的TypedArray实例
console.log("=====typedArray=======");
console.log(util.types.isTypedArray(new Uint8Array(10)));
console.log(util.types.isTypedArray(new Int8Array(10)));
//判断value是否为内置的Uint8Array实例
console.log("=====uint8Array=======");
console.log(util.types.isUint8Array(new Uint8Array(10)));
//判断value是否为布尔对象   
console.log("=====boolean=======");
console.log(util.types.isBooleanObject(false));
console.log(util.types.isBooleanObject("false"));
console.log(util.types.isBooleanObject(new Boolean(false)));
console.log(util.types.isBooleanObject(new Boolean(true)));
console.log(util.types.isBooleanObject(Boolean(false)));